<script type="text/javascript">
	$(function(){
            $('.guolv li').eq(0).hover(function(){
                $('.guolv .xiala').eq(0).show();
                $('a', this).addClass('xialaon');
            }, function() {
                $('.guolv .xiala').eq(0).hide();
                $('a', this).removeClass('xialaon');
            });

            $('.guolv li').eq(1).hover(function() {
                $('.guolv #time').show();
                $('a', this).addClass('xialaon');
            }, function() {
                $('.guolv #time').hide();
                $('a', this).removeClass('xialaon');
            });
	})
</script>
<?php 
if($this->ma === 0){
     echo '<script language="javascript" type="text/javascript">alert("该状态下取件不能由您自主操作，如您真需操作，请联系悠奇客服！");location.href="/member/vsdetail/?id='.$this->vsDeatil->id.'";</script>';
}else if($this->ma === 1){
    echo '<script language="javascript" type="text/javascript">alert("操作成功！");location.href="/member/visitinglist";</script>';
}
?>
<div class="center">
    <div class="home">
        <div class="home_left">
            <?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
        </div>
        <div class="home_right">
                <div class="smbox">
                    <i>地址薄</i>
                    <div class="smtop">
                        <h1>上门取件</h1>
                        <p>足不出户发国际快递，简单、方便、快速！<a href="/store/up">了解更多&gt;&gt;</a></p>
                    </div>
                    <div class="sm_sq">
                        <a href="/store/visiting"><span>立即申请上门取件</span></a>
                    </div>
                </div>
                <div class="smnav">
                    <ul>
                        <li class="smnav_on"><a href="javascript:void(0)">全部上门取件</a></li>
                        <li><a href="/member/vsachieve">已完成的上门取件</a></li>
                        <li><a href="/member/vscancel">已取消的上门取件</a></li>
                    </ul>
                </div>

                <div class="smtable">
                    <div class="sbiaohead">
                        <table>
                            <tr>
                                <th class="li17"><div class="slileft">取件编号</div></th>
                                <th class="li45"><div class="slileft">包裹描述</div></th>
                                <th class="li14"><div class="slileft">类型</div></th>
                                <th class="li14"><div class="slileft">状态</div></th>
                                <th class="li10"><div class="slileft">操作</div></th>
                            </tr>
                        </table>
                    </div>
                    <div class="sbiaotbody">
                        <table>
                            <?php foreach ($this->visitinglist as $visitingItem) { ?>
                                <tr>
                                    <td class="li17">
                                        <div class="slileft bianhao">
                                            <p><a href="/member/vsdetail/?id=<?= $visitingItem->id ?>"><?php echo $visitingItem->visitingNo; ?></a></p>
                                            <span><?php echo $visitingItem->dateCreated; ?></span>
                                        </div>
                                    </td>
                                    <td class="li45">
                                        <div class="slileft smname">
                                            <h2><a href="/member/vsdetail/?id=<?= $visitingItem->id ?>"><?= mb_strlen($visitingItem->waresName, 'utf-8') > 20 ? (mb_substr($visitingItem->waresName, 0, 20, 'utf-8') . '......') : $visitingItem->waresName ?></a></h2>
                                            <p><?php $address = $visitingItem->CityByCityId->name . $visitingItem->TownBy->name . $visitingItem->inlandAddress;
                                                echo mb_strlen($address, 'utf-8') > 20 ? (mb_substr($address, 0, 20, 'utf-8') . '......') : $address;
                                                    ?></p>
                                        </div>
                                    </td>
                                    <td class="li14">
                                        <div class="slileft">
                                            <?php echo $visitingItem->isWay == 1 ? "发往海外<br>" . $visitingItem->WayBill->UserCity->name : "存入仓库"; ?>
                                        </div>
                                    </td>
                                    <td class="li14">
                                        <div class="slileft">
                                            <ul class="smzt">
                                                <?php
                                                    switch ($visitingItem->status) {
                                                        case 0:
                                                            echo '<li class="f60">等待付款</li>';
                                                            break;
                                                        case -4:
                                                            echo "<li class='c00'>取件异常</li>";
                                                            break; 
                                                        case -1:
                                                            echo "<li class='s999'>已取消</li>";
                                                            break; 
                                                        default:
                                                            echo "<li>" . $visitingItem->statusname . "</li>";
                                                    }
                                                    ?>
                                                <li><a href="/member/vsdetail/?id=<?= $visitingItem->id ?>">查看详情</a></li>
                                            </ul>
                                        </div>
                                    </td>
                                    <td class="li10">
                                        <div class="slileft">
                                        <?php
                                            if ($visitingItem->status == Application_Model_VisitingServer::STATUS_WaitPay || $visitingItem->status == Application_Model_VisitingServer::STATUS_Processing) {
                                                if ($visitingItem->status == Application_Model_VisitingServer::STATUS_WaitPay) {
                                                    echo '<a href="/pay/paying/type/'.Application_Model_PayBill::TYPE_Visiting.'/id/'.$visitingItem->id.'" class="button22"><span>付款</span></a>';
                                                }
                                                echo '<a href="?oper=cancel&id=' . $visitingItem->id . '">取消上门</a>';
                                            } else { ?>
                                                <?php if($visitingItem->status == Application_Model_VisitingServer::STATUS_Cancel){ ?>
                                                    <a class="smqx" href="?oper=del&id=<?php echo $visitingItem->id;?>">删除</a>
                                                <?php } else if ($visitingItem->status == Application_Model_VisitingServer::STATUS_DeliveryProblem){ ?>
                                                    <a href="/member/vsdetail/ma/3/?id=<?php echo $visitingItem->id;?>" class="button22"><span>异常</span></a>
                                                <?php }else{?>
                                                                             <?
                                $ad = Application_Model_AdLink::getByCode('visit');
                            ?>
                            <div onmouseover="setShare('<?= $ad->getTitle($visitingItem->CityByCityId->name) ?>', '<?= $ad->getAdUrl($this->user->id) ?>','<?= $ad->getContent('') ?>');"> 
                                <!--自定义第一个分享标题和链接-->
                                <!-- JiaThis Button BEGIN -->
                                <div class="jiathis_style">       
                                <a href="http://www.jiathis.com/share/?uid=1334580904971198" class="jiathis" target="_blank">
                                    <img src="http://v2.jiathis.com/code_mini/images/btn/v1/jiathis3.gif" border="0" />
                                </a>
                                </div>
                                <!-- JiaThis Button END -->
                            </div>                  
                                            <?php } }?>
                                        </div>
                                    </td>
                                </tr>
                            <?php } ?>
                        </table>
                    </div>

                    <div class="toolbar" <?php if (empty($this->visitinglist)) echo "style='display: none'"; ?>>
                        <?php echo $this->partial('paging.phtml', array("pages" => $this->visitingAll)); ?>
                    </div>
                </div>
        </div>
    </div>
</div>
<!--单页面使用多分享按钮需要增加的分享参数代码-->                        
<script type="text/javascript">
                          function setShare(title, url,content) {
                              jiathis_config.title = title;
                              jiathis_config.url = url;
                              if(content){
                                jiathis_config.summary = content;
                              }
                          }
                            var jiathis_config = {}
                          </script>   
<!--分享参数代码结束-->
<!--分享功能代码统一放到页尾-->
<script type="text/javascript" src="http://v1.jiathis.com/code/jia.js?uid=1334580904971198" charset="utf-8"></script>
<!--分享功能代码结束-->